﻿using dotHTML.HTML;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Drawing;
#pragma warning disable 0618
namespace TestdotHTML
{
    
    
    /// <summary>
    ///This is a test class for TableTest and is intended
    ///to contain all TableTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TableTest {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Table Constructor
        ///</summary>
        [TestMethod()]
        public void TableConstructorTest() {
            Table target = new Table();
            Assert.AreEqual("<table></table>", target.ToString());
        }

        /// <summary>
        ///A test for Align
        ///</summary>
        [TestMethod()]
        public void AlignTest() {
            Table target = new Table();
            Nullable<Table.AlignmentChoices> expected = Table.AlignmentChoices.Center;
            Nullable<Table.AlignmentChoices> actual;
            target.Align = expected;
            actual = target.Align;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for BGColor
        ///</summary>
        [TestMethod()]
        public void BGColorTest() {
            Table target = new Table();
            Nullable<Color> expected = Color.Red;
            Nullable<Color> actual;
            target.BGColor = expected;
            actual = target.BGColor;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Border
        ///</summary>
        [TestMethod()]
        public void BorderTest() {
            Table target = new Table();
            Nullable<int> expected = 1;
            Nullable<int> actual;
            target.Border = expected;
            actual = target.Border;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CellPadding
        ///</summary>
        [TestMethod()]
        public void CellPaddingTest() {
            Table target = new Table();
            Nullable<int> expected = 1;
            Nullable<int> actual;
            target.CellPadding = expected;
            actual = target.CellPadding;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for CellSpacing
        ///</summary>
        [TestMethod()]
        public void CellSpacingTest() {
            Table target = new Table();
            Nullable<int> expected = 1;
            Nullable<int> actual;
            target.CellSpacing = expected;
            actual = target.CellSpacing;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Frame
        ///</summary>
        [TestMethod()]
        public void FrameTest() {
            Table target = new Table();
            Nullable<Table.FrameChoices> expected = Table.FrameChoices.Above;
            Nullable<Table.FrameChoices> actual;
            target.Frame = expected;
            actual = target.Frame;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Rules
        ///</summary>
        [TestMethod()]
        public void RulesTest() {
            Table target = new Table();
            Nullable<Table.RuleChoices> expected = Table.RuleChoices.All;
            Nullable<Table.RuleChoices> actual;
            target.Rules = expected;
            actual = target.Rules;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Summary
        ///</summary>
        [TestMethod()]
        public void SummaryTest() {
            Table target = new Table();
            string expected = string.Empty;
            string actual;
            target.Summary = expected;
            actual = target.Summary;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Width
        ///</summary>
        [TestMethod()]
        public void WidthTest() {
            Table target = new Table();
            string expected = string.Empty;
            string actual;
            target.Width = expected;
            actual = target.Width;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ToStringTest() {
            Table t = new Table();
            t.Align = Table.AlignmentChoices.Center;
            t.BGColor = Color.Red;
            t.Border = 1;
            t.CellPadding = 2;
            t.CellSpacing = 3;
            t.Frame = Table.FrameChoices.Void;
            t.Rules = Table.RuleChoices.All;
            t.Summary = "sum";
            t.Width = "10%";
            Assert.AreEqual("<table align=\"center\" " +
                "bgcolor=\"#FF0000\" " +
                "border=\"1\" " +
                "cellpadding=\"2\" " +
                "cellspacing=\"3\" " +
                "frame=\"void\" " +
                "rules=\"all\" " +
                "summary=\"sum\" " +
                "width=\"10%\"></table>", t.ToString());
        }
    }
}
